package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.dto.CommunityRoomsDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.CommunityRoomsMapper;
import com.ruoyi.system.domain.CommunityRooms;
import com.ruoyi.system.service.ICommunityRoomsService;

/**
 * roomsService业务层处理
 * 
 * @author yhb
 * @date 2024-03-24
 */
@Service
public class CommunityRoomsServiceImpl implements ICommunityRoomsService 
{
    @Autowired
    private CommunityRoomsMapper communityRoomsMapper;

    /**
     * 查询rooms
     * 
     * @param id rooms主键
     * @return rooms
     */
    @Override
    public CommunityRooms selectCommunityRoomsById(Long id)
    {
        return communityRoomsMapper.selectCommunityRoomsById(id);
    }

    /**
     * 查询rooms列表
     * 
     * @param communityRoomsDto rooms
     * @return rooms
     */
    @Override
    public List<CommunityRooms> selectCommunityRoomsList(CommunityRoomsDto communityRoomsDto)
    {
        return communityRoomsMapper.selectCommunityRoomsList(communityRoomsDto);
    }

    /**
     * 新增rooms
     * 
     * @param communityRooms rooms
     * @return 结果
     */
    @Override
    public int insertCommunityRooms(CommunityRooms communityRooms)
    {
        communityRooms.setId(communityRooms.getFloorId());
        communityRooms.setCreateTime(DateUtils.getNowDate());
        return communityRoomsMapper.insertCommunityRooms(communityRooms);
    }

    /**
     * 修改rooms
     * 
     * @param communityRooms rooms
     * @return 结果
     */
    @Override
    public int updateCommunityRooms(CommunityRooms communityRooms)
    {
        communityRooms.setUpdateTime(DateUtils.getNowDate());
        return communityRoomsMapper.updateCommunityRooms(communityRooms);
    }

    /**
     * 批量删除rooms
     * 
     * @param ids 需要删除的rooms主键
     * @return 结果
     */
    @Override
    public int deleteCommunityRoomsByIds(Long[] ids)
    {
        return communityRoomsMapper.deleteCommunityRoomsByIds(ids);
    }

    /**
     * 删除rooms信息
     * 
     * @param id rooms主键
     * @return 结果
     */
    @Override
    public int deleteCommunityRoomsById(Long id)
    {
        return communityRoomsMapper.deleteCommunityRoomsById(id);
    }

    @Override
    public List<CommunityRooms> selectCommunityRoomsPurposeList(Long purposeId) {
        return communityRoomsMapper.selectCommunityRoomsPurposeList(purposeId);
    }
}
